# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Ray Donnelly <mingw.android@gmail.com>

pkgname=make-git
#_ver_base=4.1
pkgver=4.2.1.30.ga95cb30
pkgrel=1
pkgdesc="GNU make utility to maintain groups of programs"
arch=('i686' 'x86_64')
url="https://www.gnu.org/software/make"
license=('GPL3')
provides=("make")
conflicts=("make")
depends=('msys2-runtime' 'sh' 'guile')
#options=('debug' '!strip')
makedepends=('gettext' 'gettext-devel' 'git' 'wget')
install=$pkgname.install
source=("$pkgname"::'git+https://git.savannah.gnu.org/git/make.git'
		0002-remove-Werror.patch)
sha256sums=('SKIP'
			'b6ad543c4f64aa82d75c50887d3b5133ba160700c1498af5e0f7c2fe28a173e4')

pkgver() {
  cd "$srcdir/$pkgname"
  git describe --tags | sed -e 's|-|.|g' -e 's|v||g'
  #printf "%s.%s.%s" "$_ver_base" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  cd ${srcdir}/${pkgname}
  #patch -p1 -i ${srcdir}/make-autoconf.patch
  patch -p1 -i ${srcdir}/0002-remove-Werror.patch
  autoreconf -fi
}

build() {
  cd ${srcdir}/${pkgname}
  ./configure \
    --prefix=/usr \
    --build=${CHOST} \
    --without-libintl-prefix \
    --without-libiconv-prefix \
    ac_cv_dos_paths=yes
  make -j1 scm-update do-po-update all
}

check() {
  cd ${srcdir}/${pkgname}
  make check
}

package() {
  cd ${srcdir}/${pkgname}
  make DESTDIR=${pkgdir} install
}
